{% extends "template/addEdit.volt" %}

{% block title %}新建飞机{% endblock %}

{% block content %}
    <table>
        <tr>
            <th>序列号:</th>
            <td><input type="text" value="" name="uas_serial_id"/></td>
        </tr>
        <tr>
            <th>手机号:</th>
            <td><input type="text" value="" name="phone" data-valid="phone"/></td>
        </tr>
        <tr>
            <th>飞机状态:</th>
            <td><select name="plane_type_id">
                    <option value="">请选择</option>
                    {% for id,name in planeTypeList %}
                        <option value="{{ id }}">{{ name }}</option>
                    {% endfor %}
                </select></td>
        </tr>
        <tr>
            <th>保修到期时间:</th>
            <td><input type="text" data-attr="date" value="" name="expired_at" /></td>
        </tr>
        <tr>
            <th>所属区域:</th>
            <td><select name="plane_area_id">
                    <option value="">请选择</option>
                    {% for id,name in planeAreaList %}
                        <option value="{{ id }}">{{ name }}</option>
                    {% endfor %}
                </select></td>
        </tr>
        <tr>
            <th>是否投保第三方险:</th>
            <td><select name="insurance">
                    <option value="">请选择</option>
                    <option value="1">是</option>
                    <option value="2">否</option>
                </select></td>
        </tr>
        <tr>
            <th>第三方险开始时间:</th>
            <td><input type="text" data-attr="date" value="" name="insurance_begin_at" /></td>
        </tr>
        <tr>
            <th>是否投保机身险:</th>
            <td><select name="fuselage_insurance">
                    <option value="">请选择</option>
                    <option value="1">是</option>
                    <option value="2">否</option>
                </select></td>
        </tr>
        <tr>
            <th>机身险开始时间:</th>
            <td><input type="text" data-attr="date" value="" name="fuselage_begin_at" /></td>
        </tr>
    </table>
    <table>
        <tr>
            <th>飞机型号:</th>
            <td><select name="planeModel_id">
                    <option value="">请选择</option>
                    {% for id,name in planeModelList %}
                        <option value="{{ id }}">{{ name }}</option>
                    {% endfor %}
                </select></td>
        </tr>
        <tr>
            <th>持有单位:</th>
            <td><input type="text" name="name"></td>
        </tr>
        <tr>
            <th>备注:</th>
            <td><input type="text" name="company"></td>
        </tr>
        <tr>
            <th>购买时间:</th>
            <td><input type="text" name= "buy_at" data-attr="date" value=""></td>
        </tr>
        <tr>
            <th>保修公里数:</th>
            <td><input type="text" name="warranty_kilometer" data-valid="number"></td>
        </tr>
        <tr>
            <th></th>
            <td></td>
        </tr>
        <tr>
            <th>第三方险结束时间:</th>
            <td><input type="text" data-attr="date" name="insurance_end_at"></td>
        </tr>
        <tr>
            <th></th>
            <td></td>
        </tr>
        <tr>
            <th>机身险结束时间:</th>
            <td><input type="text" data-attr="date" name="fuselage_end_at"></td>
        </tr>
    </table>
{% endblock %}

{% block jscontent %}
    <script>
        function addAction(){
            if (DataValidBinder.valid()){
                var params = "action_key=ACTION_ADD&" + $("form").serialize();
                $.post("/plane/addPlane", params, function (result){
                    if(result){
                        FAlert(result.message);
                    }else{
                        Falert("添加失败");
                    }
                });
            }
        }
    </script>

{% endblock %}